#coding:utf-8
from Comm.webdriver_base import WebDriverBase
import time
from Comm.Log import LogUtil
from selenium.webdriver.common.by import By

logger = LogUtil("Login").get_logger()

class Login(WebDriverBase):

    def login(self):
        # 访问轻喜到家H5登录界面
        self.open_url(r"https://day.m.qxdaojia.com/pagesD/login/index")
        #手机号输入框输入
        self.loc_method("uni-input-input", "send_keys", method='CLASS', text="17727843208")
        # 勾选协议
        self.driver.find_element(By.CSS_SELECTOR, ".flex-row-align img").click()
        time.sleep(1)
        # 点击获取验证码
        self.loc_method(".cu-btn", "click", method='CSS_SELECTOR')
        time.sleep(1)
        # 验证码输入框输入
        self.loc_method("/html/body/uni-app/uni-page/uni-page-wrapper/uni-page-body/uni-view/uni-view[1]/uni-view[2]/uni-view[2]/uni-input/div/input", "send_keys", method='XPATH', text="111111")
        # 点击登录
        self.loc_method(".confirm-btn", "click", method='CSS_SELECTOR')
        self.get_screen_img()
        time.sleep(1)
        logger.info("测试login方法")
